﻿// See https://aka.ms/new-console-template for more information
using iTool.Common;
using iTool.Core;
using iTool.Utils;

Console.WriteLine("Hello, World!");


//var result1 = await TestCallServer.InvokeAsync(new PluginRequestBodyParameter
//{
//    PluginName = "ZXS",
//    ExportMethodName = "Msg",
//    Parameters = new object[] { "xxx"}
//});

//Console.WriteLine(result1);







iPrint.Error(Watch.TimerByMilliseconds(() =>
{

    //List<Task<dynamic>> tasks = new List<Task<dynamic>>();

    Parallel.For(0, 10000, async i =>
    {
        //Console.WriteLine(i);
        var task = TestCallServer.InvokeAsync(new PluginRequestBodyParameter
        {
            PluginName = "SqlServer111",
            ExportMethodName = "Test",
            Parameters = new object[] { "sql", "s2xxxxxx", 50 }
        });
        await task;
        //Console.WriteLine(await task);
    });

    //Task.WaitAll(tasks);

}).ToString());





var result = await TestCallServer.InvokeAsync(new PluginRequestBodyParameter
{
    PluginName = "SqlServer111",
    ExportMethodName = "Test",
    Parameters = new object[] { "sql", "s2xxxxxx", 50 }
});

Console.WriteLine(result);


while (true)
{
    result = await TestCallServer.InvokeAsync(new PluginRequestBodyParameter
    {
        PluginName = "Helleo",
        ExportMethodName = "You",
        Parameters = new object[] { "magey" }
    });

    Console.WriteLine(result);

    await Task.Delay(1000);
}

//result = await TestCallServer.InvokeAsync(new PluginRequestBodyParameter
//{
//    PluginName = "Helleo",
//    ExportMethodName = "You2",
//    Parameters = new object[] { "Kity" }
//});

//Console.WriteLine(result);

Console.ReadKey();